/**
 * Created by liubin on 2014/09/03.
 */
define(['angular', 'services'], function (angular, services) {
    'use strict';
    services.factory('userListService', ['$resource', 'baseService', 'pageSize',
        function ($resource, baseService, pageSize) {
        var res = $resource(urlRoute.getUrl('api_user_list'),{},
            {
                get: {
                    method: 'get',
                    params: {}
                },
                post: {method: 'post'}
            }
        );
        var listSev = {};
        angular.forEach(['get', 'post'], function (value, key) {
            this[value] = function (args, posts, successFunc, failureFunc, errorFunc) {
                baseService.process(res, value, args, posts, successFunc, failureFunc, errorFunc);
            }
        }, listSev);
        return listSev;
    }]).factory('userService', ['$resource', 'baseService', function ($resource, baseService) {
        var res = $resource(urlRoute.getUrl('api_user_list') + '/:id',
            {
                id: '@id'
            },
            {
                get: {method: 'get'},
                post: {method: 'post'},
                put: {method: 'put'},
                delete: {method: 'delete'}
            }
        );
        var listSev = {};
        angular.forEach(['get','post','put', 'delete'], function (value, key) {
            this[value] = function (args, posts, successFunc, failureFunc, errorFunc) {
                baseService.process(res, value, args, posts, successFunc, failureFunc, errorFunc);
            }
        }, listSev);
        return listSev;
    }]);
});